package cn.itcast.service.impl;

import cn.itcast.dao.StandardDao;
import cn.itcast.domain.Courier;
import cn.itcast.domain.Standard;
import cn.itcast.service.StandardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StandardServiceImpl implements StandardService {
    @Autowired
    private StandardDao standardDao;

    @Override
    public void save(Standard standard) {
        standardDao.save(standard);
    }

    @Override
    public Page<Standard> pageQuery(int page,int rows) {
        PageRequest pageRequest = PageRequest.of(page-1, rows);
        Page<Standard> page1 = standardDao.findAll(pageRequest);
        return page1;
    }

    @Override
    public List<Standard> findAll() {
        return standardDao.findAll();
    }


}
